import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)
let store = new Vuex.Store({
  state: {
    city: '北京'
  },

  getters: {
    getCityFn: state => {
      return state.city
    }
  },

  mutations: {
    setCity (state, name) {
      state.city = name
    }
  },

  actions: {
    setCityName ({ commit, state }, name) {
      commit('setCity', name)
    }
  }

})

export default store
